package com.blb.controller;

import com.blb.pojo.BranchEnterprise;
import com.blb.pojo.News;
import com.blb.service.BranchEnterpriseService;
import com.blb.util.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 祖星毅
 */
@RestController
@CrossOrigin(origins = "*")
@Api(tags = "分支企业动态")
public class BranchEnterpriseController {
    @Autowired
    private BranchEnterpriseService branchEnterpriseService;

    /**
     * 分支公司动态表的分页查找
     * @param pageNum
     * @param pageSize
     * @return
     */
    @ApiOperation(value = "分页展示分支企业动态")
    @GetMapping("/branch")
    public Page get(@ApiParam(name = "pageNum",value = "当前页",required = true) @RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum,
                    @ApiParam(name = "pageSize",value = "每页数量",required = true) Integer pageSize) {
        return branchEnterpriseService.selectByPage(pageNum, pageSize);
    }

    /**
     * 分支公司动态表通过主键id查找
     * @param id
     * @return
     */
    @ApiOperation(value = "根据分支企业动态id查询")
    @GetMapping("/branch/{id}")
    public BranchEnterprise get(@ApiParam(name = "id",value = "分支企业id",required = true) @PathVariable Integer id) {
        return branchEnterpriseService.selectByPrimaryKey(id);
    }
}
